<template>
    <div class="mask">
        <div class="TMB-warp">
            <div class="titler">
                <span class="font-w fs16" style="font-weight: 700;">{{ title }}</span>
                <i class="el-icon-close" @click="CloseTables"></i>
            </div>
            <div class="middle">
                <!-- <div class="router">
                    <el-breadcrumb separator-class="el-icon-arrow-right">
                        <el-breadcrumb-item v-for="(item, index) in projectRouteData" :key="index"
                            @click.native="GetBookRelaAssFileApi(item.id, 'del')">
                            {{ item.name }}
                        </el-breadcrumb-item>
                    </el-breadcrumb>
                </div> -->
                <ux-grid class="ux-table" ref="singleTable" :data="prposTabelData" :header-cell-style="{
                    color: 'rgba(0, 0, 0, 0.85)',
                    fontSize: '14px',
                    textAlign: 'left',
                    fontWeight: 'bold',
                    padding: 0,
                    height: '32px',
                    background: 'rgb(244,245,246)'
                }" :cell-style="{
                    color: 'rgba(96,98,102,1)',
                    fontSize: '14px',
                    textAlign: 'left',
                    padding: 0,
                    height: '32px',
                }" :checkbox-config="{
                    showHeader: false,
                    checkMethod: checkMethod
                }" @selection-change="handleSelectionChange" @current-change="handleCurrentChange" highlight-current-row
                    v-loading="loading" element-loading-spinner="el-icon-loading" element-loading-background="#f8f8f8"
                    :element-loading-text="$t('message.bhView.loading')" height="500">
                    <template slot="empty"> No data </template>
                    <ux-table-column type="checkbox" width="40" align="center" title="" v-if="type != 'portray'">
                    </ux-table-column>
                    <ux-table-column property="label" title="定点No">
                        <template slot-scope="scope">
                            <p>{{ scope.row.posOrdr }}</p>
                        </template>
                    </ux-table-column>
                    <ux-table-column property="label" title="定点名称">
                        <template slot-scope="scope">
                            <p>{{ scope.row.posName }}</p>
                        </template>
                    </ux-table-column>
                    <ux-table-column property="label" title="測定部位" :width="150">
                        <template slot-scope="scope">
                            <p>{{ scope.row.partName }}</p>
                        </template>
                    </ux-table-column>
                    <ux-table-column property="label" title="材質名称" :width="150">
                        <template slot-scope="scope">
                            <p>{{ scope.row.mtrName }}</p>
                        </template>
                    </ux-table-column>
                    <ux-table-column property="label" title="サイズ">
                        <template slot-scope="scope">
                            <p>{{ scope.row.sizName }}</p>
                        </template>
                    </ux-table-column>
                    <ux-table-column property="label" title="元肉厚">
                        <template slot-scope="scope">
                            <p>{{ scope.row.orgThck }}</p>
                        </template>
                    </ux-table-column>
                    <ux-table-column property="label" title="管理値">
                        <template slot-scope="scope">
                            <p>{{ scope.row.mgtThck }}</p>
                        </template>
                    </ux-table-column>
                    <ux-table-column property="label" title="建設年月">
                        <template slot-scope="scope">
                            <p>{{ scope.row.chgDate }}</p>
                        </template>
                    </ux-table-column>

                </ux-grid>
                <div class="footer">
                    <span></span>
                    <div>
                        <el-button type="default" size="mini" @click="CloseTables">Cancel</el-button>
                        <el-button type="primary" size="mini" @click="okFn">OK</el-button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
import BASE from '@/utils/base'
import { getThckStyleRefer } from '@/api/api'
import eventBus from "@/eventBus/bus";

export default {
    name: "RightTabelShow",
    props: ["type", "title", "ClsType"],
    data() {
        return {
            prposTabelData: [
                // {
                //     test: 111
                // }
            ],
            loading: false,
            selectionArr: [],
            cnt: 0,
            LineNo: '',
            projectRouteData: [
                {
                    name: 'Disk',
                    id: '0'
                }
            ],
            activeRow: {}

        };
    },
    components: {},
    watch: {},
    methods: {
        //表格方法，同种通知可以査看，不同图纸不可以选择
        checkMethod({ row }) {
            return row.fileType == 1;
        },
        handleSelectionChange(e) {
            console.log(e);
            this.selectionArr = e;
        },
        handleCurrentChange(val) {
            console.log(val);
            this.activeRow = val;
        },
        okFn() {
            console.log(this.activeRow);
            this.$emit("getResponse", this.activeRow);
            this.$emit('close');
        },
        CloseTables() {
            this.$emit('close')
        },
        // id 请求路径的，type=》'add'进入目录添加路径，'del'进入路径，削除之后路径
        async GetBookRelaAssFileApi() {
            let dataJson = {
                dmgCode: this.$store.state.macCode,
            }
            let res = await getThckStyleRefer(dataJson);

            this.loading = false;

            if (res.data.code != 0) {
                return
            }
            this.prposTabelData = res.data.data;
            this.$refs.singleTable.setCurrentRow(this.prposTabelData[0]);
            this.activeRow = this.prposTabelData[0];
        },
    },
    created() { },
    mounted() {
        this.GetBookRelaAssFileApi();
    },
    beforeDestroy() { },
    destroyed() { },
    updated() {
        // 使用querySelectorAll选中所有带有.elx-cell--checkbox类的元素
        var elements = document.querySelectorAll('.elx-cell--checkbox');

        // 遍历这些元素  
        elements.forEach(function (element) {
            // 修改每个元素的title属性  
            element.setAttribute('title', '');
        })
    },
};
</script>
<style lang="scss" scoped>
.mask {
    width: 100vw;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9999;


}

.TMB-warp {
    width: 1000px;
    background: rgb(255, 255, 255);
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translateX(-50%) translateY(-50%);
    box-shadow: 0px 12px 48px 16px rgba(0, 0, 0, 0.05),
        0px 9px 28px 0px rgba(0, 0, 0, 0.08), 0px 6px 16px -8px rgba(0, 0, 0, 0.15);
    z-index: 100;

    .titler {
        height: 43px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 13px 24px;
        border-bottom: 1px solid #F0F0F0FF;

        i {
            cursor: pointer;
        }
    }

    .middle {
        padding: 13px 24px;

        .router {
            padding-bottom: 13px;
        }

        .title {
            display: flex;
            margin-bottom: 13px;

            .seach {
                width: 24px;
                height: 24px;
                border-radius: 4px;
                border: 1px solid #d9d9d9;
                display: flex;
                align-items: center;
                justify-content: center;
                cursor: pointer;
                margin-right: 12px;
            }

            .form-ipt {
                height: 24px;

                ::v-deep .el-input__inner {
                    width: 197px;
                    height: 24px;
                    background: #fff;
                }
            }
        }

        ::v-deep .ux-table * {
            border: none;
        }

        ::v-deep .elx-table {
            border: 1px solid #00000026;
        }

        .table {
            border-bottom: 1px solid red !important;
        }

        .footer {
            height: 43px;
            // background-color: #EDEEEFFF;
            // border: 1px solid #00000026;
            // border-top: none;
            margin-top: 15px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 4px;
        }
    }
}

.iconfont {
    font-size: 24px;
    margin: 0 8px;
}

.tableIcon {
    font-size: 20px;
    margin: 0 4px;
}

.el-breadcrumb__item {
    cursor: pointer;
}
</style>
